/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DeployMenu.java
 *
 * Created on 30.11.2011, 13:23:37
 */
package de.aeo.bll;

import java.awt.Component;
import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

/**
 * @author Frederic Branczyk & Robert Piwonski
 */
public class DeployMenu extends javax.swing.JFrame {
   
    private DefaultComboBoxModel dcbm1;
    private DefaultComboBoxModel dcbm2;
    private DefaultComboBoxModel dcbm3;
    private DefaultComboBoxModel dcbm4;
    private Algorithm a;
    private ResultFrame rf = null;
    
    /** Creates new form DeployMenu */
    public DeployMenu(Algorithm a) {
        this.a = a;
        String[] str = {
        this.a.getLanguageString("<none>"),
        this.a.getLanguageString("layer")+" 1",
        this.a.getLanguageString("layer")+" 2",
        this.a.getLanguageString("layer")+" 3",
        this.a.getLanguageString("layer")+" 4"};
        this.dcbm1 = new DefaultComboBoxModel(str);
        this.dcbm2 = new DefaultComboBoxModel(str);
        this.dcbm3 = new DefaultComboBoxModel(str);
        this.dcbm4 = new DefaultComboBoxModel(str);
        initComponents();
        MyCellRenderer mcr = new MyCellRenderer();
        this.jList1.setCellRenderer(mcr);
        this.jList2.setCellRenderer(mcr);
        this.jList3.setCellRenderer(mcr);
        this.jList4.setCellRenderer(mcr);
        this.updateLayers();
        this.updateOverfilled();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jList3 = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        jList2 = new javax.swing.JList();
        jScrollPane3 = new javax.swing.JScrollPane();
        jList4 = new javax.swing.JList();
        jScrollPane4 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jButtonList1toList2 = new javax.swing.JButton();
        jButtonList2toList1 = new javax.swing.JButton();
        jButtonList2toList3 = new javax.swing.JButton();
        jButtonList3toList2 = new javax.swing.JButton();
        jButtonList3toList4 = new javax.swing.JButton();
        jButtonList4toList3 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jList5 = new javax.swing.JList();
        jComboBox1 = new javax.swing.JComboBox();
        jComboBox2 = new javax.swing.JComboBox();
        jComboBox3 = new javax.swing.JComboBox();
        jComboBox4 = new javax.swing.JComboBox();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jList3.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(jList3);

        jList2.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane2.setViewportView(jList2);

        jList4.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane3.setViewportView(jList4);

        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane4.setViewportView(jList1);

        jLabel1.setText(this.a.getLanguageString("layer")+" 1");

        jLabel2.setText(this.a.getLanguageString("layer")+" 2");

        jLabel3.setText(this.a.getLanguageString("layer")+" 3");

        jLabel4.setText(this.a.getLanguageString("layer")+" 4");

        jButtonList1toList2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/aeo/bll/arrowRight.png"))); // NOI18N
        jButtonList1toList2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonList1toList2ActionPerformed(evt);
            }
        });

        jButtonList2toList1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/aeo/bll/arrowLeft.png"))); // NOI18N
        jButtonList2toList1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonList2toList1ActionPerformed(evt);
            }
        });

        jButtonList2toList3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/aeo/bll/arrowRight.png"))); // NOI18N
        jButtonList2toList3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonList2toList3ActionPerformed(evt);
            }
        });

        jButtonList3toList2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/aeo/bll/arrowLeft.png"))); // NOI18N
        jButtonList3toList2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonList3toList2ActionPerformed(evt);
            }
        });

        jButtonList3toList4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/aeo/bll/arrowRight.png"))); // NOI18N
        jButtonList3toList4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonList3toList4ActionPerformed(evt);
            }
        });

        jButtonList4toList3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/aeo/bll/arrowLeft.png"))); // NOI18N
        jButtonList4toList3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonList4toList3ActionPerformed(evt);
            }
        });

        jButton7.setText(this.a.getLanguageString("finish"));
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jLabel5.setText("0");

        jLabel6.setText(this.a.getLanguageString("crossovers")+":");

        jList5.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jList5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList5MouseClicked(evt);
            }
        });
        jList5.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList5ValueChanged(evt);
            }
        });
        jScrollPane5.setViewportView(jList5);

        jComboBox1.setModel(this.dcbm1);
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jComboBox2.setModel(this.dcbm2);

        jComboBox3.setModel(this.dcbm3);

        jComboBox4.setModel(this.dcbm4);

        jButton2.setText(this.a.getLanguageString("split"));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jButtonList1toList2, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jLabel1))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                            .addComponent(jButtonList2toList1)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jButtonList2toList3))
                                        .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jLabel2)))
                            .addComponent(jScrollPane5))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel3)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jButtonList3toList2)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jButtonList3toList4))
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(4, 4, 4)
                                        .addComponent(jLabel4))
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jButtonList4toList3)
                                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton2))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonList1toList2)
                            .addComponent(jButtonList2toList1)
                            .addComponent(jButtonList2toList3)
                            .addComponent(jButtonList3toList2)
                            .addComponent(jButtonList3toList4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButton2))))
                    .addComponent(jButtonList4toList3))
                .addGap(36, 36, 36)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton7)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonList1toList2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonList1toList2ActionPerformed
        if(this.jList1.getSelectedIndex()!=-1) {
            this.a.moveCourse(0, this.jList1.getSelectedIndex(), 1);
            this.updateLayers();
        }
    }//GEN-LAST:event_jButtonList1toList2ActionPerformed

    private void jButtonList2toList1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonList2toList1ActionPerformed
        if(this.jList2.getSelectedIndex()!=-1) {
            this.a.moveCourse(1, this.jList2.getSelectedIndex(), -1);
            this.updateLayers();
        }
    }//GEN-LAST:event_jButtonList2toList1ActionPerformed

    private void jButtonList2toList3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonList2toList3ActionPerformed
        if(this.jList2.getSelectedIndex()!=-1) {
            this.a.moveCourse(1, this.jList2.getSelectedIndex(), 1);
            this.updateLayers();
        }
    }//GEN-LAST:event_jButtonList2toList3ActionPerformed

    private void jButtonList3toList2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonList3toList2ActionPerformed
        if(this.jList3.getSelectedIndex()!=-1) {
            this.a.moveCourse(2, this.jList3.getSelectedIndex(), -1);
            this.updateLayers();
        }
    }//GEN-LAST:event_jButtonList3toList2ActionPerformed

    private void jButtonList3toList4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonList3toList4ActionPerformed
        if(this.jList3.getSelectedIndex()!=-1) {
            this.a.moveCourse(2, this.jList3.getSelectedIndex(), 1);
            this.updateLayers();
        }
    }//GEN-LAST:event_jButtonList3toList4ActionPerformed

    private void jButtonList4toList3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonList4toList3ActionPerformed
        if(this.jList4.getSelectedIndex()!=-1) {
            this.a.moveCourse(3, this.jList4.getSelectedIndex(), -1);
            this.updateLayers();
        }
    }//GEN-LAST:event_jButtonList4toList3ActionPerformed

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBox1ActionPerformed

    private void jList5ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList5ValueChanged
        if(this.jList5.getSelectedIndex()!=-1) {
            Course c = this.a.getOverfilled().get(this.jList5.getSelectedIndex());
            ArrayList<Integer> preSelections = this.a.suggestion(c);
//            System.out.println(c.toString());
//            System.out.println(preSelections.toString());
            this.jComboBox1.setSelectedIndex(preSelections.get(0)+1);
            this.jComboBox2.setSelectedIndex(preSelections.get(1)+1);
            this.jComboBox3.setSelectedIndex(preSelections.get(2)+1);
            this.jComboBox4.setSelectedIndex(preSelections.get(3)+1);
        }
    }//GEN-LAST:event_jList5ValueChanged

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        if(this.jComboBox1.getSelectedIndex() != 0 || this.jComboBox2.getSelectedIndex() != 0 ||
                this.jComboBox3.getSelectedIndex() != 0 || this.jComboBox4.getSelectedIndex() != 0) {
            ArrayList<Integer> list = new ArrayList<Integer>();
            if(this.jComboBox1.getSelectedIndex() != 0)
                list.add(this.jComboBox1.getSelectedIndex()-1);
            if(this.jComboBox2.getSelectedIndex() != 0)
                list.add(this.jComboBox2.getSelectedIndex()-1);
            if(this.jComboBox3.getSelectedIndex() != 0)
                list.add(this.jComboBox3.getSelectedIndex()-1);
            if(this.jComboBox4.getSelectedIndex() != 0)
                list.add(this.jComboBox4.getSelectedIndex()-1);
            Course c = (Course) this.jList5.getSelectedValue();
            this.a.setAllUnchangeable();
            this.a.setSchedule(this.a.splitCourse(c, list));
            this.updateLayers();
            this.updateOverfilled();
            this.jComboBox1.setSelectedIndex(0);
            this.jComboBox2.setSelectedIndex(0);
            this.jComboBox3.setSelectedIndex(0);
            this.jComboBox4.setSelectedIndex(0);
        }

    }//GEN-LAST:event_jButton2ActionPerformed

    private void jList5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList5MouseClicked

    }//GEN-LAST:event_jList5MouseClicked

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        this.a.finish();
        if(this.rf==null) {
            this.rf = new ResultFrame(this.a);
        }else{
            this.rf.updateObject();
        }
        this.rf.setLocation(
                this.getX()+(this.getWidth()/2)-(this.rf.getWidth()/2), 
                this.getY()+(this.getHeight()/2)-(this.rf.getHeight()/2));
        this.setVisible(false);
        this.rf.setVisible(true);
    }//GEN-LAST:event_jButton7ActionPerformed

    private void updateLayers() {
        ArrayList<ArrayList<Course>> list = this.a.getSchedule();
        DefaultListModel model1 = new DefaultListModel();
        for(Course c:list.get(0)) {
            model1.add(model1.getSize(), c);
        }
        this.jList1.setModel(model1);
        DefaultListModel model2 = new DefaultListModel();
        for(Course c:list.get(1)) {
            model2.add(model2.getSize(), c);
        }
        this.jList2.setModel(model2);
        DefaultListModel model3 = new DefaultListModel();
        for(Course c:list.get(2)) {
            model3.add(model3.getSize(), c);
        }
        this.jList3.setModel(model3);
        DefaultListModel model4 = new DefaultListModel();
        for(Course c:list.get(3)) {
            model4.add(model4.getSize(), c);
        }
        this.jList4.setModel(model4);
        this.jLabel5.setText(""+this.a.countOverlap());
    }
    
    private void updateOverfilled() {
        ArrayList<Course> list = this.a.getOverfilled();
        DefaultListModel model1 = new DefaultListModel();
        for(Course c:list) {
            model1.add(model1.getSize(), c);
        }
        this.jList5.setModel(model1);
    }
    
    public void updateObject() {
        String[] str = {
        this.a.getLanguageString("<none>"),
        this.a.getLanguageString("layer")+" 1",
        this.a.getLanguageString("layer")+" 2",
        this.a.getLanguageString("layer")+" 3",
        this.a.getLanguageString("layer")+" 4"};
        this.dcbm1 = new DefaultComboBoxModel(str);
        this.jComboBox1.setModel(dcbm1);
        this.dcbm2 = new DefaultComboBoxModel(str);
        this.jComboBox2.setModel(dcbm2);
        this.dcbm3 = new DefaultComboBoxModel(str);
        this.jComboBox3.setModel(dcbm3);
        this.dcbm4 = new DefaultComboBoxModel(str);
        this.jComboBox4.setModel(dcbm4);
        this.jLabel1.setText(this.a.getLanguageString("layer")+" 1");
        this.jLabel2.setText(this.a.getLanguageString("layer")+" 2");
        this.jLabel3.setText(this.a.getLanguageString("layer")+" 3");
        this.jLabel4.setText(this.a.getLanguageString("layer")+" 4");
        this.jButton2.setText(this.a.getLanguageString("split"));
        this.jButton7.setText(this.a.getLanguageString("finish"));
        this.jLabel6.setText(this.a.getLanguageString("crossovers")+":");
        this.updateLayers();
        this.updateOverfilled();
    }
    
    class MyCellRenderer extends JLabel implements ListCellRenderer {
        final ImageIcon lockIcon = new ImageIcon(getClass().getResource("/de/aeo/bll/lock.gif"));

         // This is the only method defined by ListCellRenderer.
         // We just reconfigure the JLabel each time we're called.

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index,
                                                  boolean isSelected, boolean cellHasFocus) {
            String s = value.toString();
            setText(s);
            Course c = (Course) value;
            if(!c.getChangeable())
                setIcon(lockIcon);
            if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
            }else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
            }
            setEnabled(list.isEnabled());
            setFont(list.getFont());
            setOpaque(true);
            return this;
        }
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButtonList1toList2;
    private javax.swing.JButton jButtonList2toList1;
    private javax.swing.JButton jButtonList2toList3;
    private javax.swing.JButton jButtonList3toList2;
    private javax.swing.JButton jButtonList3toList4;
    private javax.swing.JButton jButtonList4toList3;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JComboBox jComboBox4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JList jList1;
    private javax.swing.JList jList2;
    private javax.swing.JList jList3;
    private javax.swing.JList jList4;
    private javax.swing.JList jList5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    // End of variables declaration//GEN-END:variables
}
